<?php
	if (isset($_GET['update'])) {
		confirmPayment($_POST['billid'], $_POST['username']);
	}
	
	$notifications = getNotifications($_SESSION['username']);
	
	echo '<div id="bills">
			<h3>Notifications</h3>
			<p>Select the "Confirm Payment Received" button to confirm you have received payment for the listed bills.</p>
			';
	
	if (!$notifications || (mysql_numrows($notifications) < 1)) {
		echo '<p>There are no notifications to display.</p>';
	}
	else {
		while ($row = mysql_fetch_array($notifications)) {
			echo '<fieldset>
					<p>Bill: ' . $row[2] . '</p>
					<p>Member: ' . $row[3] . ' ' . $row[4] . '</p>
					<p>Amount: $' . $row[5] . '</p>
					<p>Paid on: ' . $row[6] . '</p>
					<form name="confirmPayment" id="confirmPayment" method="post" action="?viewnotifications&update">
					<input type="hidden" name="billid" id="billid" value="' . $row[0] . '" />
					<input type="hidden" name="username" id="username" value="' . $row[1] . '" />
					<input type="submit" value="Confirm Payment Received" />
					</form>
					</fieldset>';
			
		}
	}
	echo '</div>';
?>